home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Developer / Marlais 0.3.1 / gc4.1-mac / Makefile < prev    next >
Encoding:
Makefile  |  1994-07-26  |  8.6 KB  |  206 lines  |  [TEXT/R*ch]

  1. # Primary targets:
  2. # gc.a - builds basic library
  3. # c++ - adds C++ interface to library and include directory
  4. # cords - adds cords (heavyweight strings) to library and include directory
  5. # test - prints porting information, then builds basic version of gc.a, and runs
  6. #        some tests of collector and cords.  Does not add cords or c++ interface to gc.a
  7. # cord/de - builds dumb editor based on cords.
  8. CC= cc
  9. CXX=g++
  10. # Needed only for "make c++", which adds the c++ interface
  11.  
  12. CFLAGS= -O -DALL_INTERIOR_POINTERS -DSILENT
  13. # Setjmp_test may yield overly optimistic results when compiled
  14. # without optimization.
  15. # -DSILENT disables statistics printing, and improves performance.
  16. # -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
  17. #   altered stubborn objects, at substantial performance cost.
  18. # -DFIND_LEAK causes the collector to assume that all inaccessible
  19. #   objects should have been explicitly deallocated, and reports exceptions
  20. # -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
  21. #   (Clients should also define SOLARIS_THREADS and then include
  22. #   gc.h before performing thr_ or GC_ operations.)
  23. # -DALL_INTERIOR_POINTERS allows all pointers to the interior
  24. #   of objects to be recognized.  (See gc_private.h for consequences.)
  25. # -DSMALL_CONFIG tries to tune the collector for small heap sizes,
  26. #   usually causing it to use less space in such situations.
  27. #   Incremental collection no longer works in this case.
  28. # -DDONT_ADD_BYTE_AT_END is meaningful only with
  29. #   -DALL_INTERIOR_POINTERS.  Normally -DALL_INTERIOR_POINTERS
  30. #   causes all objects to be padded so that pointers just past the end of
  31. #   an object can be recognized.  This can be expensive.  (The padding
  32. #   is normally more than one byte due to alignment constraints.)
  33. #   -DDONT_ADD_BYTE_AT_END disables the padding.
  34.  
  35. AR= ar
  36. RANLIB= ranlib
  37.  
  38.  
  39. # Redefining srcdir allows object code for the nonPCR version of the collector
  40. # to be generated in different directories
  41. srcdir = .
  42. VPATH = $(srcdir)
  43.  
  44. OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o typd_mlc.o
  45.  
  46. CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c typd_mlc.c
  47.  
  48. CORD_SRCS=  cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c cord/cord.h cord/ec.h cord/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC
  49.  
  50. CORD_OBJS=  cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
  51.  
  52. SRCS= $(CSRCS) mips_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s sparc_mach_dep.s gc.h gc_typed.h gc_hdrs.h gc_priv.h gc_private.h config.h gc_mark.h gc_inl.h gc_inline.h gc.man if_mach.c if_not_there.c gc_c++.cc gc_c++.h $(CORD_SRCS)
  53.  
  54. OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE \
  55.            README test.c setjmp_t.c SMakefile.amiga SCoptions.amiga \
  56.            README.amiga README.win32 cord/README include/gc.h \
  57.            include/gc_typed.h README.QUICK callprocs pc_excludes \
  58.            barrett_diagram README.OS2
  59.  
  60. CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \
  61.            $(srcdir)/cord/cord_pos.h
  62.  
  63. # Libraries needed for curses applications.  Only needed for de.
  64. CURSES= -lcurses -ltermlib
  65.  
  66. # The following is irrelevant on most systems.  But a few
  67. # versions of make otherwise fork the shell specified in
  68. # the SHELL environment variable.
  69. SHELL= /bin/sh
  70.  
  71. SPECIALCFLAGS = 
  72. # Alternative flags to the C compiler for mach_dep.c.
  73. # Mach_dep.c often doesn't like optimization, and it's
  74. # not time-critical anyway.
  75. # Set SPECIALCFLAGS to -q nodirect_code on Encore.
  76.  
  77. ALPHACFLAGS = -non_shared
  78. # Extra flags for linking compilation on DEC Alpha
  79.  
  80. all: gc.a gctest
  81.  
  82. pcr: PCR-Makefile gc_private.h gc_hdrs.h gc.h config.h mach_dep.o $(SRCS)
  83.     make -f PCR-Makefile depend
  84.     make -f PCR-Makefile
  85.  
  86. $(OBJS) test.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
  87.     $(srcdir)/config.h $(srcdir)/gc_typed.h Makefile
  88. # The dependency on Makefile is needed.  Changing
  89. # options such as -DSILENT affects the size of GC_arrays,
  90. # invalidating all .o files that rely on gc_priv.h
  91.  
  92. mark.o typd_mlc.o finalize.o: $(srcdir)/gc_mark.h
  93.  
  94. gc.a: $(OBJS)
  95.     $(AR) ru gc.a $(OBJS)
  96.     $(RANLIB) gc.a || cat /dev/null
  97. #    ignore ranlib failure; that usually means it doesn't exist, and isn't needed
  98.  
  99. cords: $(CORD_OBJS) cord/cordtest
  100.     $(AR) ru gc.a $(CORD_OBJS)
  101.     $(RANLIB) gc.a || cat /dev/null
  102.     cp $(srcdir)/cord/cord.h include/cord.h
  103.     cp $(srcdir)/cord/ec.h include/ec.h
  104.     cp $(srcdir)/cord/cord_pos.h include/cord_pos.h
  105.  
  106. gc_c++.o: $(srcdir)/gc_c++.cc $(srcdir)/gc_c++.h
  107.     $(CXX) -c -O $(srcdir)/gc_c++.cc
  108.     
  109. c++: gc_c++.o $(srcdir)/gc_c++.h
  110.     $(AR) ru gc.a gc_c++.o
  111.     $(RANLIB) gc.a || cat /dev/null
  112.     cp $(srcdir)/gc_c++.h include/gc_c++.h 
  113.  
  114. mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_mach_dep.s $(srcdir)/rs6000_mach_dep.s if_mach if_not_there
  115.     rm -f mach_dep.o
  116.     ./if_mach MIPS "" as -o mach_dep.o $(srcdir)/mips_mach_dep.s
  117.     ./if_mach RS6000 "" as -o mach_dep.o $(srcdir)/rs6000_mach_dep.s
  118.     ./if_mach ALPHA "" as -o mach_dep.o $(srcdir)/alpha_mach_dep.s
  119.     ./if_mach SPARC SUNOS5 as -o mach_dep.o $(srcdir)/sparc_mach_dep.s
  120.     ./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
  121.  
  122. mark_rts.o: $(srcdir)/mark_rts.c if_mach if_not_there
  123.     rm -f mark_rts.o
  124.     ./if_mach ALPHA "" $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
  125.     ./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
  126. #    work-around for DEC optimizer tail recursion elimination bug
  127.  
  128. cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
  129.     $(CC) $(CFLAGS) -c $(srcdir)/cord/cordbscs.c
  130.     mv cordbscs.o cord/cordbscs.o
  131. #  not all compilers understand -o filename
  132.  
  133. cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
  134.     $(CC) $(CFLAGS) -c $(srcdir)/cord/cordxtra.c
  135.     mv cordxtra.o cord/cordxtra.o
  136.  
  137. cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
  138.     $(CC) $(CFLAGS) -c $(srcdir)/cord/cordprnt.c
  139.     mv cordprnt.o cord/cordprnt.o
  140.  
  141. cord/cordtest: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
  142.     rm -f cord/cordtest
  143.     ./if_mach SPARC SUNOS5 $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lthread
  144.     ./if_not_there cord/cord_test $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
  145.  
  146. cord/de: $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a
  147.     rm -f cord/de
  148.     ./if_mach SPARC SUNOS5 $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a $(CURSES) -lthread
  149.     ./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a -lcurses
  150.     ./if_not_there cord/de $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a $(CURSES)
  151.  
  152. if_mach: $(srcdir)/if_mach.c $(srcdir)/config.h
  153.     $(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c
  154.  
  155. if_not_there: $(srcdir)/if_not_there.c
  156.     $(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c
  157.  
  158. clean: 
  159.     rm -f gc.a test.o gctest output-local output-diff $(OBJS) \
  160.           setjmp_test  mon.out gmon.out a.out core if_not_there if_mach \
  161.           $(CORD_OBJS) cord/cordtest cord/de
  162.     -rm -f *~
  163.  
  164. gctest: test.o gc.a if_mach if_not_there
  165.     rm -f gctest
  166.     ./if_mach ALPHA "" $(CC) $(CFLAGS) -o gctest $(ALPHACFLAGS) test.o gc.a
  167.     ./if_mach SPARC SUNOS5 $(CC) $(CFLAGS) -o gctest $(CFLAGS) test.o gc.a -lthread
  168.     ./if_not_there gctest $(CC) $(CFLAGS) -o gctest test.o gc.a
  169.  
  170. # If an optimized setjmp_test generates a segmentation fault,
  171. # odds are your compiler is broken.  Gctest may still work.
  172. # Try compiling setjmp_t.c unoptimized.
  173. setjmp_test: $(srcdir)/setjmp_t.c $(srcdir)/gc.h if_mach if_not_there
  174.     rm -f setjmp_test
  175.     ./if_mach ALPHA "" $(CC) $(CFLAGS) -o setjmp_test $(ALPHACFLAGS) $(srcdir)/setjmp_t.c
  176.     ./if_not_there setjmp_test $(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
  177.  
  178. test: setjmp_test gctest
  179.     ./setjmp_test
  180.     ./gctest
  181.     make cord/cordtest
  182.     cord/cordtest
  183.  
  184. gc.tar: $(SRCS) $(OTHER_FILES)
  185.     tar cvf gc.tar $(SRCS) $(OTHER_FILES)
  186.     
  187. pc_gc.tar: $(SRCS) $(OTHER_FILES)
  188.     tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES)
  189.  
  190. floppy: pc_gc.tar
  191.     -mmd a:/cord
  192.     -mmd a:/include
  193.     mkdir /tmp/pc_gc
  194.     cat pc_gc.tar | (cd /tmp/pc_gc; tar xvf -)
  195.     -mcopy -tmn /tmp/pc_gc/* a:
  196.     -mcopy -tmn /tmp/pc_gc/cord/* a:/cord
  197.     -mcopy -mn /tmp/pc_gc/cord/de_win.ICO a:/cord
  198.     -mcopy -tmn /tmp/pc_gc/include/* a:/cord
  199.     rm -r /tmp/pc_gc
  200.  
  201. gc.tar.Z: gc.tar
  202.     compress gc.tar
  203.  
  204. lint: $(CSRCS) test.c
  205.     lint -DLINT $(CSRCS) test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall"
  206.